#ifndef UDPCLIENTFORM_H
#define UDPCLIENTFORM_H

#include <QWidget>
#include "InputParameter.h"
#include <QUdpSocket>


namespace Ui {
class UdpClientForm;
}

class UdpClientForm : public QWidget
{
    Q_OBJECT

public:
    explicit UdpClientForm(QWidget *parent = nullptr);
    ~UdpClientForm();

    bool IsOpen(){
        if(this->m_udp && this->m_udp->isOpen()){
            return true;
        }
        return false;
    };


public:
    void initSocket();

    void Send(const stParameter& parameter);

public slots:
    void slot_readPendingDatagrams();
    void slot_connect();
    void slot_disconnect();

signals:
    void SigData(const QByteArray& data);

private:
    Ui::UdpClientForm *ui;

    QUdpSocket* m_udp;
};

#endif // UDPCLIENTFORM_H
